package com.hxd.otc.module.coin_deal.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hxd.otc.R;
import com.hxd.otc.module.coin_deal.bean.ChooseCoinBean;
import com.hxd.otc.utils.StringUtil;
import com.hxd.otc.utils.UIUtils;

/**
 * 包  名 :  com.hxd.otc.module.order.adapter
 * 类  名 :  OllOrderAdapter
 * 作  者 :  zjl
 * 时  间 :  2018/6/5 18:03
 * 描  述 :  ${全部订单页面}
 */
public class ChooseTwoCoinAdapter extends BaseQuickAdapter<ChooseCoinBean.DataBean, BaseViewHolder> {
    private int selectPos = 0;

    public void setSelectPos(int selectPos) {
        this.selectPos = selectPos;
        notifyDataSetChanged();
    }
    public ChooseTwoCoinAdapter() {
        super(R.layout.item_choose_two_view, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, ChooseCoinBean.DataBean item) {
        if (selectPos == helper.getLayoutPosition()) {
            helper.setTextColor(R.id.tv_coin, UIUtils.getContext().getResources().getColor(R.color.color_text1));
        } else {
            helper.setTextColor(R.id.tv_coin, UIUtils.getContext().getResources().getColor(R.color.color_FF323232));
        }
        helper.setText(R.id.tv_coin, item.transPair);
        helper.setText(R.id.tv_price, StringUtil.format4Number(Double.valueOf(item.price)));

    }
}
